package com.shop.user.api.service.impl;

import com.shop.common.model.InputBean;
import com.shop.common.model.ServiceBean;
import com.shop.common.model.param.user.MessageInput;
import com.shop.common.model.result.user.MessageOutput;
import com.shop.common.tmpl.BaseService;
import com.shop.user.api.service.IMessageSvc;
import com.shop.user.atom.atomsvc.IMessageAtomSvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 *
 * @author zhoulk
 * @date: 2019年05月08日  17:46
 */
@Service
public class MessageSvc extends BaseService implements IMessageSvc {

    @Autowired
    IMessageAtomSvc messageAtomSvc;

    @Override
    public ServiceBean<String> sendMsg(MessageInput messageInput) {
        return null;
    }

    @Override
    public ServiceBean<String> modMsg(MessageInput messageInput) {
        int i = messageAtomSvc.modeMessage(messageInput);
        if (i>0){
            return resultSuccess();
        }
        return resultFailed();
    }

    @Override
    public ServiceBean<String> delMsg(Integer userId, Integer msgId) {
        int i = messageAtomSvc.delMessageById(msgId);
        if (i>0){
            return resultSuccess();
        }
        return resultFailed();
    }

    @Override
    public ServiceBean<List<MessageOutput>> qryMsgList4P(InputBean<MessageInput> inputBean) {
        return messageAtomSvc.qryMessage4P(inputBean);
    }
}
